﻿@model CNDreams.Web.Models.ModelTreePageModuleAssetNonAssetCommunityIndex
@{
    Layout = "~/Views/Shared/_LayoutEmbeddedFrame.cshtml";
}
<style type="text/css">
    #tree
    {
        float: left;
        height: 100%;
        margin: 1px 0 0 0;
        width: 160px;
        background: #FBFBFB;
        border: 1px solid #DADADA;
        padding: 10px 0 0 0;
    }
</style>
<script type="text/javascript">
	$(function () {
		$("#tree").height($("html").height());

		/* 初始化树
		----------------------------------------------------------*/
		var tree = $("#tree").jstree({
			"types": {
				"valid_children": ["root"],
				"types": {
					"root": {
						"icon": {
							"image": "/Content/images/all_project.jpg"
						},

						"hover_node": false,
						"select_node": function () { }
					},

					"community": {
						"icon": {
							"image": "/Content/images/ico2.jpg"
						},
						"select_node": function () {

						}
					},
					"buiding": {
						"icon": {
							"image": "/Content/images/ico3.jpg"
						},
						"select_node": function () {

						}
					},
					"parking": {
						"icon": {
							"image": "/Content/images/icon/parking.png"
						},
						"select_node": function () {

						}
					},
					"car": {
						"icon": {
							"image": "/Content/images/icon/car.png"
						},
						"select_node": function () {

						}
					}
				}
			},
			"plugins": ["themes", "html_data", "ui", "types"]
		});
		tree.bind("loaded.jstree", function (event, data) {
			tree.jstree("open_all");

			/* 选中树节点
			----------------------------------------------------------*/
			var url = window.top.getCacheValue();
			if (url == undefined || url == null) {
				setFrameUrl("/ModuleAsset/NonAssetCommunity/Index")
			} else {
				setFrameUrl(url);


				$("a").each(function () {
					if ($(this).attr("onclick").indexOf(url) != -1) {
						$(this).addClass("jstree-clicked");
					}
				});
			}
		});



	});

    function setFrameUrl(url) {
        $("#embeddedFrame").attr("src", url);
        window.top.setCacheValue(url);
    }

</script>
<div id="tree">
    <ul>
        <li rel="root"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetCommunity/Index?CommunityType=@(CNDreams.Enum.EnumCommunityType.自建小区)')" >
            自建小区</a>
            <ul>
                @foreach (var item in Model.UTNonAssetCommunitySelfCollection)
                {
                    <li rel="community"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetBuilding/index/?communityID=@item.ID')" title="@item.Name" >@Project.Common.StringUtility.CutString(item.Name, 7)</a>
                        <ul>
                            @foreach (var buildingItem in Model.UTNonAssetBuildingCollection.Where(x => x.CommunityID == item.ID))
                            {
                                <li rel="buiding"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetRoom/index/?buildingID=@buildingItem.ID&CommunityType=@(CNDreams.Enum.EnumCommunityType.自建小区)')">
                                    @(string.IsNullOrEmpty(buildingItem.Name) ? buildingItem.No.ToString() + "幢" : buildingItem.Name)
                                </a></li>
                            }
                            <li rel="parking"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/ParkingConfig/index/?communityID=@item.ID')">
                                小区停车位</a>
                                <ul>
                                    @foreach (var ParkingItem in Model.UTParkingAreaCollection.Where(x => x.CommunityID == item.ID))
                                    {
                                        <li rel="car"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/ParkingSpace/index/?ParkingAreaID=@ParkingItem.ID')">
                                            @ParkingItem.AreaName
                                        </a></li>
                                    }
                                </ul>
                            </li>
                        </ul>
                    </li>
                    
                       
                }
            </ul>
        </li>
        <li rel="root"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetCommunity/Index?CommunityType=@(CNDreams.Enum.EnumCommunityType.收储房源)')">
            收储房源</a>
            <ul>
                @foreach (var item in Model.UTNonAssetCommunityOutsideCollection)
                {
                    <li rel="community"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetBuilding/index/?communityID=@item.ID')" title="@item.Name" >@Project.Common.StringUtility.CutString(item.Name, 7)</a>
                        <ul>
                            @foreach (var buildingItem in Model.UTNonAssetBuildingCollection.Where(x => x.CommunityID == item.ID))
                            {
                                <li rel="buiding"><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetRoom/index/?buildingID=@buildingItem.ID&CommunityType=@(CNDreams.Enum.EnumCommunityType.收储房源)')">
                                    @(string.IsNullOrEmpty(buildingItem.Name) ? buildingItem.No.ToString() + "幢" : buildingItem.Name)
                                </a></li>
                            }
                        </ul>
                    </li>
                }
            </ul>
        </li>
    </ul>
</div>
